package com.spring.picture.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.spring.picture.model.dto.space.SpaceAddRequest;
import com.spring.picture.model.dto.space.SpaceQueryRequest;
import com.spring.picture.model.entity.Space;
import com.spring.picture.model.entity.User;
import com.spring.picture.model.vo.space.SpaceVO;


import javax.servlet.http.HttpServletRequest;

/**
* @author 朱鹏霖
* @description 针对表【space(空间)】的数据库操作Service
* @createDate 2025-04-29 10:33:46
*/
public interface SpaceService extends IService<Space> {

    long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);

    /**
     * 校验空间
     */
    void validSpace(Space space,boolean add);

    /**
     * 封装查询条件
     */
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);

    SpaceVO getSpaceVO(Space space, HttpServletRequest request);

    /**
     * 分页获取空间封装
     */
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);

    /**
     * 根据空间级别填充空间对象
     * @param space
     */
    void fillSpaceBySpaceLevel(Space space);

    /**
     * 校验空间权限，仅管理员和本人可修改
     * @param loginUser
     * @param space
     */
    void checkSpaceAuth(User loginUser, Space space);
}
